<html>
<title>tasks-android-sample</title>
<body>
  <h2>Instructions for the Tasks V1 Android Sample</h2>

  <h3>Browse Online</h3>

  <ul>
    <li><a
      href="http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg/tasks-android-sample">Browse
        Source</a>, or main file <a
      href="http://code.google.com/p/google-api-java-client/source/browse/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java?repo=samples">TasksSample.java</a>
    </li>
  </ul>

  <h3>Checkout Instructions</h3>

  <p>
    <b>Prerequisites:</b> install <a href="http://java.com">Java 6</a>, <a
      href="http://mercurial.selenic.com/">Mercurial</a> (requires 1.6 or
    higher) and <a href="http://maven.apache.org/download.html">Maven</a>
    (requires 3.0 or higher). You may need to set your
    <code>JAVA_HOME</code>
    .
  </p>

  <p>
    <b>Important:</b> after checking out the project, and before compiling and
    running it, you need to edit
    <code>ClientCredentials.java</code>
    to enter the required API key generated from <a
      href="https://code.google.com/apis/console/">Google APIs Console</a>.
    Without a valid key, you will only be able to make a limited number of
    queries per second. When you exceed this limit, you will receive a
    <code>403 Forbidden</code>
    error with the message
    <code>Daily Limit Exceeded. Please sign up</code>
    . You will then have to wait a period of time while the limited quota
    regenerates.
  <pre>
    <code>cd <i>[someDirectory]</i>
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
cd google-api-java-client-samples/shared/shared-sample-android
<i>[editor]</i> src/main/java/com/google/api/services/samples/shared/android/ClientCredentials.java
mvn source:jar install</code>
  </pre>

  <h3>Setup Project in Eclipse 3.7 (Indigo)</h3>

  <p>
    <b>Prerequisites:</b> install <a href="http://www.eclipse.org/downloads/">Eclipse</a>,
    the <a href="http://javaforge.com/project/HGE">Mercurial plugin</a>, the <a
      href="http://eclipse.org/m2e/">Maven plugin</a>, and the <a
      href="http://developer.android.com/sdk/eclipse-adt.html#installing">Android
      plugin</a>.
  </p>

  <ul>
    <li>Preferences:
      <ul>
        <li>Android: setup SDK location</li>
      </ul></li>
    <li>Window &gt; Android SDK and AVD Manager
      <ul>
        <li>Follow instructions to install Package "Google API's by Google
          Inc., Android API 8"</li>
        <li>Follow instructions to create a new Android Virtual Device
          based on target "Google API's (Google Inc.) - API Level 8"</li>
        <li>Click "Start..." (wait a while...)</li>
        <li>On home screen in emulator, click Menu button, Settings</li>
        <li>Click on "Accounts and Sync"</li>
        <li>Click on "Add Account"</li>
        <li>Click "Google" and follow instructions</li>
      </ul></li>
    <li>Import <code>tasks-android-sample</code> project
      <ul>
        <li>File &gt; Import...</li>
        <li>Select "General &gt; Existing Project into Workspace" and click
          "Next"</li>
        <li>Click "Browse" next to "Select root directory", find <code>
            <i>[someDirectory]</i>/google-api-java-client-samples/tasks-android-sample
          </code> and click "Next"</li>
        <li>Click "Finish"</li>
      </ul></li>
    <li>Clean Project (if compile error about missing gen directory)
      <ul>
        <li>Select <code>tasks-android-sample</code> project</li>
        <li>Project &gt; Clean...</li>
        <li>Select "Clean projects selected below"</li>
        <li>Click on "OK"</li>
      </ul></li>
    <li>Run
      <ul>
        <li>Right-click on project tasks-android-sample</li>
        <li>Run As &gt; Android Application</li>
      </ul></li>
  </ul>

  <h3>Setup Project with Maven</h3>

  <ul>
    <li><code>cd google-api-java-client-samples/tasks-android-sample</code>
    </li>
    <li>Uncomment the dependency on android in <code>pom.xml</code>
    </li>
    <li><code>mvn install android:deploy android:run</code></li>
  </ul>

</body>
</html>
